tools/libxl: Fix libxl__carefd_opened() to be more useful with an invalid fd
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 14 Jul 2015 09:38:46 +0000 (10:38 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 15 Jul 2015 10:22:53 +0000 (11:22 +0100)
commita8d23067bc0eb4d50626caea64fe9c924b66f77a
tree300fa86d0393e9df45fa3b59927774ddc48ac0f0
parentaefc3418c2181eee86309962b64b6f3043a085d3
tools/libxl: Fix libxl__carefd_opened() to be more useful with an invalid fd

In the case that fd is -1, preserve errno and don't attempt to set
CLOEXEC.

Note that the implementation can still fail, as it ignores fcntl()
errors and may not set CLOEXEC properly.  Update the documentation
accordingly until it is fixed.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
Fixing the fnctl() error issue involves more TUITs than I currently
have.

New in v4
tools/libxl/libxl_fork.c
tools/libxl/libxl_internal.h